<?php
/**
 *
 * @author ninetyseven.
 * @date 2023-03-27 22:53
 */

namespace App\Services;

use App\Enum\CodeEnum;
use App\Http\Clients\ZccmzjgyxmClient;
use GuzzleHttp\Exception\GuzzleException;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;

class BackendService
{
    public static function advanceScoreApply($phone, $score)
    {
        try {
            return (new ZccmzjgyxmClient())->advanceScoreApply($phone,$score);
        } catch (\Exception $e) {
            return [CodeEnum::ERROR, $e->getMessage()];
        } catch (GuzzleException $e) {
            return [CodeEnum::ERROR, $e->getMessage()];
        }
    }
    public static function advanceScoreSuccess($advanceNo, $score)
    {
        try {
            return (new ZccmzjgyxmClient())->advanceScoreSuccess($advanceNo, $score);
        } catch (\Exception $e) {
            return [CodeEnum::ERROR, $e->getMessage()];
        } catch (GuzzleException $e) {
            return [CodeEnum::ERROR, $e->getMessage()];
        }
    }
    public static function advanceScoreCancel($advanceNo)
    {
        try {
            return (new ZccmzjgyxmClient())->advanceScoreCancel($advanceNo);
        } catch (\Exception $e) {
            return [CodeEnum::ERROR, $e->getMessage()];
        } catch (GuzzleException $e) {
            return [CodeEnum::ERROR, $e->getMessage()];
        }
    }
    public static function getUserScore($phone)
    {
        try {
            return (new ZccmzjgyxmClient())->getUserConsume($phone);
        } catch (\Exception $e) {
            return [CodeEnum::ERROR, $e->getMessage()];
        } catch (GuzzleException $e) {
            return [CodeEnum::ERROR, $e->getMessage()];
        }
    }

}
